package com.dgy.eval.service.impl;

import java.util.List;

import com.dgy.eval.domain.TeachEvalItem;
import com.dgy.eval.domain.vo.TeachEvalDetailVO;
import com.dgy.eval.service.ITeachEvalItemService;
import com.dgy.eval.service.ITeachEvalSummaryService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dgy.eval.mapper.TeachEvalRecordMapper;
import com.dgy.eval.domain.TeachEvalRecord;
import com.dgy.eval.service.ITeachEvalRecordService;

/**
 * 教学评价记录Service业务层处理
 * 
 * @author ccc
 * @date 2025-02-12
 */
@Service
public class TeachEvalRecordServiceImpl implements ITeachEvalRecordService 
{
    @Autowired
    private TeachEvalRecordMapper teachEvalRecordMapper;

    @Autowired
    private ITeachEvalSummaryService teachEvalSummaryService;

    @Autowired
    private ITeachEvalItemService iTeachEvalItemService;

    /**
     * 查询教学评价记录
     * 
     * @param recordId 教学评价记录主键
     * @return 教学评价记录
     */
    @Override
    public TeachEvalDetailVO selectTeachEvalRecordByRecordId(Long recordId)
    {
        TeachEvalDetailVO teachEvalDetailVO = new TeachEvalDetailVO();
        // 评价基本信息
        teachEvalDetailVO.setTeachEvalRecord(teachEvalRecordMapper.selectTeachEvalRecordByRecordId(recordId));
        // 评价明细
        TeachEvalItem teachEvalItem = new TeachEvalItem();
        teachEvalItem.setRecordId(recordId);
        teachEvalDetailVO.setItemList(iTeachEvalItemService.selectTeachEvalItemList(teachEvalItem));
        // 评价总结
        teachEvalDetailVO.setTeachEvalSummary(teachEvalSummaryService.selectTeachEvalSummaryByRecordId(recordId));
        return teachEvalDetailVO;
    }

    /**
     * 查询教学评价记录列表
     * 
     * @param teachEvalRecord 教学评价记录
     * @return 教学评价记录
     */
    @Override
    public List<TeachEvalRecord> selectTeachEvalRecordList(TeachEvalRecord teachEvalRecord)
    {
        return teachEvalRecordMapper.selectTeachEvalRecordList(teachEvalRecord);
    }

    /**
     * 新增教学评价记录
     * 
     * @param teachEvalRecord 教学评价记录
     * @return 结果
     */
    @Override
    public int insertTeachEvalRecord(TeachEvalRecord teachEvalRecord)
    {
        teachEvalRecord.setCreateTime(DateUtils.getNowDate());
        return teachEvalRecordMapper.insertTeachEvalRecord(teachEvalRecord);
    }

    /**
     * 修改教学评价记录
     * 
     * @param teachEvalRecord 教学评价记录
     * @return 结果
     */
    @Override
    public int updateTeachEvalRecord(TeachEvalRecord teachEvalRecord)
    {
        teachEvalRecord.setUpdateTime(DateUtils.getNowDate());
        return teachEvalRecordMapper.updateTeachEvalRecord(teachEvalRecord);
    }

    /**
     * 批量删除教学评价记录
     * 
     * @param recordIds 需要删除的教学评价记录主键
     * @return 结果
     */
    @Override
    public int deleteTeachEvalRecordByRecordIds(Long[] recordIds)
    {
        return teachEvalRecordMapper.deleteTeachEvalRecordByRecordIds(recordIds);
    }

    /**
     * 删除教学评价记录信息
     * 
     * @param recordId 教学评价记录主键
     * @return 结果
     */
    @Override
    public int deleteTeachEvalRecordByRecordId(Long recordId)
    {
        return teachEvalRecordMapper.deleteTeachEvalRecordByRecordId(recordId);
    }
}
